﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Helpers
{
    public static class Logger
    {
        public static string LogPath { get; set; }

        public static void Write(string line)
        {
            if (!Directory.Exists(LogPath))
                Directory.CreateDirectory(LogPath);
            StreamWriter sw = null;
            try
            {
                sw = new StreamWriter(Path.Combine(LogPath,
                                string.Format("xlibris_{0:yyyyMMdd}.log", DateTime.Now)), true);
                sw.WriteLine(DateTime.Now.ToString("hh:mm:ss") + "  " + line);
            }
            finally
            {
                sw.Close();
            }
        }
    }
}
